package com.example.mapper;

import com.example.pojo.Dept;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DeptMapper {

    //查询全部的部门数据
    @Select("select id, name, create_time, update_time from tb_dept")
    List<Dept> deptlist();

    //根据id删除部门数据
    @Delete("delete from tb_dept where id = #{id}")
    void deleteById(Integer id);

    //插入部门数据
    @Insert("insert into tb_dept(name,create_time,update_time) values (#{name},#{createTime},#{updateTime})")
    void insert(Dept dept);


    Dept selectById(Integer id);

    void update(Dept dept);
}
